<?php

namespace app\index\controller;

use app\common\model\Feed;
use app\common\model\User;
use think\Controller;
use think\exception\DbException;

class Article extends Controller
{
    /**
     * 显示文章内容
     *
     * @param $id
     * @return mixed
     * @throws DbException
     */
    public function detail($id)
    {
        $article = Feed::get($id);
        if(!$article){
            $this->error("文章不存在","/");
        }

        $author = User::get($article['uid']);

        $this->assign("author",$author);
        $this->assign("article",$article);
        return $this->fetch();
    }
}
